/**
 * Created by Allen on 2018/1/25.
 */
import config from 'config'
import httpFetch from 'share/httpFetch'

export default {
  //获取差标设置列表数据
  getTravelStandardList(params){
    return httpFetch.get(`${config.baseUrl}/api/travel/itinerary/stand`, params)
  },

  //根据公司id获取补贴类型列表
  getTravelSubsidyList(id){
    return httpFetch.get(`${config.baseUrl}/api/company/all/expense/types?companyOID=${id}`)
  },

  //根据差旅类型id获取差标规则列表
  getStandardRuleList(page,pageSize,id){
    return httpFetch.get(`${config.baseUrl}/api/travel/rule/list?page=${page}&size=${pageSize}&travelItineraryStandID=${id}`)
  },

  //根据id删除差旅标准单条规则
  deleteTravelStandardRule(id){
    return httpFetch.delete(`${config.baseUrl}/api/travel/rule?id=${id}`)
  },

  //根据费用类型id获取差补规则列表
  getSubsidyRuleList(id,page,pageSize){
    return httpFetch.get(`${config.baseUrl}/api/travelstandardsettings/by/expensetype?expenseTypeOID=${id}&page=${page}&size=${pageSize}`)
  },

  //根据id删除差旅补贴单条规则
  deleteTravelSubsidyRule(id){
    return httpFetch.delete(`${config.baseUrl}/api/travelstandardsettings/${id}`)
  },

  //根据差旅类型id获取票务类型
  getTicketClass(id){
    return httpFetch.get(`${config.baseUrl}/api/travel/rule/condition/enum/v2?itineraryType=${id}`)
  },

  //获取城市级别
  getCityLevels(){
    return httpFetch.get(`${config.baseUrl}/api/levels/my?deleted=false&page=0&size=1000`)
  },

  //差旅标准规则保存
  saveTravelStandardRule(method,params){
    return httpFetch[method](`${config.baseUrl}/api/travel/rule`,params)
  },

  /**
   * 得到所有值列表
   * 这里返回的结果是租户的系统值列表 + 公司的自定义值列表
   * @param page
   * @param size
   */
  getCustomEnumeration(page, size){
    return httpFetch.get(`${config.baseUrl}/api/custom/enumerations`, {page, size});
  },

  /**
   * 得到所有值列表
   * 这里返回的结果是租户的系统值列表 + 租户的自定义值列表
   * @param page
   * @param size
   */
  getCustomEnumerationInTenant(page, size){
    return httpFetch.get(`${config.baseUrl}/api/custom/enumerations/by/custom/form`, {page, size});
  },

  //获取值列表项
  getCustomEnumerationItems(oid){
    return httpFetch.get(`${config.baseUrl}/api/custom/enumerations/${oid}`);
  },

  //获取酒店标准配置数据
  //id 行程标准id
  getHotelTypes(id){
    return httpFetch.get(`${config.baseUrl}/api/travel/itinerary/stand/detail?id=${id}`);
  },

  //保存酒店标准配置数据
  saveHotelTypes(params){
    return httpFetch.put(`${config.baseUrl}/api/travel/itinerary/stand`, params)
  },

  //获取酒店标准配置范围
  getHotelTypesScope(){
    return httpFetch.get(`${config.baseUrl}/api/travel/itinerary/stand/hotel/types`);
  },

  //差旅补贴规则保存
  saveTravelSubsidyRule(method,params){
    return httpFetch[method](`${config.baseUrl}/api/travelstandardsettings`,params)
  },

  //获取用餐类型列表
  getSceneList(page, pageSize, id) {
    return httpFetch.get(`${config.baseUrl}/api/dining/scene/list?page=${page}&size=${pageSize}&travelItineraryStandId=${id}`);
  },

  //新建 ／ 保存 用餐类型
  saveDiningScene(params) {
    return httpFetch.post(`${config.baseUrl}/api/dining/scene`, params);
  },

  //根据id删除用餐类型
  deleteDiningScene(id){
    return httpFetch.delete(`${config.baseUrl}/api/dining/scene?id=${id}`);
  },

  //根据id获取用餐类型详情
  getSceneDetail(id) {
    return httpFetch.get(`${config.baseUrl}/api/dining/scene?id=${id}`);
  },

  //获取用餐类型下的差标列表
  getStandardList(page, pageSize, id) {
    return httpFetch.get(`${config.baseUrl}/api/travel/rule/list/dining/scene?page=${page}&size=${pageSize}&diningSceneId=${id}`);
  },

  getCityLevelDetail(levelOID) {
    return httpFetch.get(`${config.baseUrl}/api/levels/v3/${levelOID}`)
  },

}
